<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>钱包明细</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <style>
        .aui-tab-item{font-size: .8rem;height: 2.5rem;line-height: 2.5rem;}
        .aui-tab-item.aui-active{border-color: #f0392b;color: #f0392b;}
        .sx{color: #f5334c;}
        .aui-list-item-right.jia{color: #21ba45;}
        .aui-list-item-right.jian{color: #f5334c;}
        .aui-list{background-image: linear-gradient(0,#f4f4f4,#f4f4f4 50%,transparent 50%);}
        .aui-list .aui-list-item{background-image: -webkit-linear-gradient(90deg,#f4f4f4,#f4f4f4 50%,transparent 50%);}
    </style>
</head>
<body>
    <div class="aui-tab stab" id="tab">
	    <div class="aui-tab-item aui-active">余额明细</div>
	    <div class="aui-tab-item ">提现记录</div>
        <div class="aui-tab-item ">积分记录</div>
	</div>
	<section class="aui-content">
		<div class="aui-margin-b-15">
		    <ul class="aui-list aui-media-list" id="list">
		        
		    </ul>
		</div>
	</section>
	<p class="nomore">没有了</p>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/aui-tab.js" ></script>
<script type="text/javascript" src="../script/zepto.min.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
	var p=0,type=1;
    apiready = function(){
        api.parseTapmode();
        var s = parseInt(api.pageParam.other||1);
        type = s;
        //滚动监听
        api.addEventListener({
            name:'scrolltobottom',
            extra:{
                threshold:0 //设置距离底部多少距离时触发，默认值为0，数字类型
            }
        }, function(ret, err){        
            //_toast('已滚动到底部');
            getData(type);
        });
        //tab切换
	    var tab = new auiTab({
	        element:document.getElementById("tab"),
	        index:s,
	        repeatClick:false
	    },function(ret){
	    	p=0;
	    	type = ret.index;
	    	$('#list').html('');
	    	$('.nomore').hide();
	    	getData(type);
	    });
	    getData(type);
    };
    function getData(type){
    	p++;
    	_loading2();
    	_Ajax(window.APIServer.MoneyLogs,'post',{values:{type:type,p:p}},'json',function(ret){
    		_loading2_close();
             if (ret.code==1) {
             	var list='';
             	switch(type){
                    case 1:
                    $(ret.data).each(function(k,v){
                        list += '<li class="aui-list-item aui-list-item-middle">';
                        list += '<div class="aui-media-list-item-inner">';
                        list += '<div class="aui-list-item-inner">';
                        list += '<div class="aui-list-item-text">';
                        list += '<div class="aui-list-item-title aui-font-size-14">'+v.title+'</div>';
                        if (v.money>0) {
                            list += '<div class="aui-list-item-right jia">+'+v.money+'</div>';
                        }else{
                            list += '<div class="aui-list-item-right jia jian">'+v.money+'</div>';
                        }
                        list += '</div><div class="aui-list-item-text">';
                        list += v.time+'<sapn></span>';
                        list += '</div></div></div>';
                        list += '</li>';
                    });
                    break;
             		case 2:
             		$(ret.data).each(function(k,v){
                        list += '<li class="aui-list-item aui-list-item-middle">';
                        list += '<div class="aui-media-list-item-inner">';
                        list += '<div class="aui-list-item-inner">';
                        list += '<div class="aui-list-item-text">';
                        list += '<div class="aui-list-item-title aui-font-size-14">'+v.title+'</div>';
                        list += '<div class="aui-list-item-right jian">'+v.money_rel+'</div>';
                        list += '</div><div class="aui-list-item-text">';
                        list += v.status_text+'<sapn>'+v.time+'</span>';
                        list += '</div></div></div>';
                        list += '</li>';
                    });
             		break;
                    case 3:
                    $(ret.data).each(function(k,v){
                        list += '<li class="aui-list-item aui-list-item-middle">';
                        list += '<div class="aui-media-list-item-inner">';
                        list += '<div class="aui-list-item-inner">';
                        list += '<div class="aui-list-item-text">';
                        list += '<div class="aui-list-item-title aui-font-size-14">'+v.title+'</div>';
                        if (v.score>0) {
                            list += '<div class="aui-list-item-right jia">+'+v.score+'</div>';
                        }else{
                            list += '<div class="aui-list-item-right jia jian">'+v.score+'</div>';
                        }
                        list += '</div><div class="aui-list-item-text">';
                        list += v.time+'<sapn></span>';
                        list += '</div></div></div>';
                        list += '</li>';
                    });
                    break;
             	}
             	$('#list').append(list);
             }else{
             	p--;
             	$('.nomore').show();
             }
         });
    }
</script>
</html>